<template>
  <v-container>
    <v-row>
      <v-col cols="8" class="mx-auto mb-1">
        <v-text-field
          background-color="white"
          prepend-inner-icon="mdi-magnify"
          placeholder="搜索(按 回车)"
          outlined
          clearable
          v-model="keyword"
          @keydown.native.enter="toSearch"
        ></v-text-field>

        <v-tabs background-color="light-green lighten-5" >
          <v-tab :to="{path:'/search/feed', query: {keyword}}">动态</v-tab>
          <v-tab :to="{path:'/search/user', query: {keyword}}">用户</v-tab>
        </v-tabs>
      </v-col>
    </v-row>
    <v-divider></v-divider>

    <v-row >
      <v-col cols="8" class="mx-auto">
        <router-view></router-view>
      </v-col>
    </v-row>
  </v-container>
</template>

<script>
export default {
  name: 'MySearch',
  data: ()=>({
    keyword: '',
  }),
  methods:{
    toSearch(){
      const keyword = this.keyword
      this.$router.push({query: {keyword, rand: Math.random()}})
    }
  }
}
</script>

<style scoped>

</style>